<%-- 
    Document   : formEmpIntervenant
    Created on : 26 févr. 2013, 12:17:01
    Author     : ali
--%>

<%@page import="EDT.obj.Salle"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                
        <title>Emplois du temps Salle form</title>
            <link rel="stylesheet" href="Accueil.css" />
            <link rel="SHORTCUT ICON" href="./edt.jpg" />
    </head>


    <body>    
         
    <section>
      

        

        
         
    <!--<form method='POST' action='PromoNivGradForm.do'> -->
   <%
    String form ="";
    ArrayList<Salle> salle = new ArrayList<Salle>();
    
    if(session.getAttribute("salle") == null || request.getParameter("salle")==null){
        
        salle = EDT.api.API.getSalle();                
        session.setAttribute( "salle", salle );
        form += "<form method='POST' action='ConsultEmploiSalle.do' target='section'>";
        form += "<div class='commentaire'>";
        form += "<fieldset>";
        
        
        form +="<legend>    Choisissez une salle  :   </legend>";
        form +="Salle : <select name='salle'>";
        for (Salle i : salle)
        form +="    <option value='"+i.getId()+"'>"+i.getNom()+"</option>";
        form +="</select><br/><br/>";
        
        
        
               }else{
        
        salle = (ArrayList<Salle> ) session.getAttribute("salle");
        form +="<form method='POST' action='EmpSalle.do' target='section'>\n";
        form += "<div class='commentaire'>\n";
        form += "<fieldset>";
        
        
        form += "<legend>    Choisissez une année scolaire :   </legend>";
        
        int s = Integer.parseInt(request.getParameter("salle"));
        form += "<input type='hidden' name='idsalle' value='"+s+"'/>"; 
        
        for (Salle i : salle){
            if(i.getId() == s)
                form += "<input type='hidden' name='nomsalle' value='"+i.getNom()+"'/>";
        }
        
        form += "Annee : <select name='annee'>";

        ArrayList<Integer> annee = EDT.api.API.getAnneeMinMax();
        for (int i = annee.get(0) ; i<= annee.get(1); i++ )
            form += "<option value='"+i+"'>"+i+"/"+(i+1)+"</option>";
         
        form += "</select><br/><br/>";
        
            //out.println(form);
            
        session.removeAttribute("salle");
                       
               }
    
        form +="<input type='submit' value='valider'/><br/>";
        out.println(form);
            
    %>
    
   
    
    
    <html:errors/> 
    
    </fieldset>
    
        
    </div>

    </form>
         
    </section>
    </body>
</html>
